// Copyright 2008 Senary
// See credits.txt for details.

// This file is part of Omega VII.

// Omega VII is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Omega VII is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Omega VII.  If not, see <http://www.gnu.org/licenses/>.

#include "SpaceshipPanel.h"
#include "Spaceship.h"

SpaceshipPanel::SpaceshipPanel(void)
	: _shield(_VAR(0))
{
	_panelDefinition += "digits(64, 128, \"Shield: %3.0f\", *, 1, 0);\n";
}

SpaceshipPanel::~SpaceshipPanel(void)
{
}

// param timestep: time since the last update, in seconds
// param totalTime: total time the game has been running
void SpaceshipPanel::update(float timestep, float totalTime)
{
	if (_observed != 0) {
		Spaceship* ss = dynamic_cast<Spaceship*>(_observed);
		_shield = _VAR(ss->getShield());
	}
}

//create PANEL useable by engine
void SpaceshipPanel::createPanel()
{
	RightPanel::createPanel();
	digits_set(_pPanel, _VAR(1), &_shield);
}
